home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4876 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  877 b 

  1. Path: news.uni-jena.de!news
  2. From: mkt@isun04.inf.uni-jena.de (Tilo Koerbs)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Derived->Base a Signature match?
  5. Date: 1 Feb 1996 12:16:36 GMT
  6. Organization: Lehrstuhl fuer Rechnerarchitektur- und kommunikation, FSU Jena
  7. Message-ID: <4eqav4$fpu@fsuj01.rz.uni-jena.de>
  8. References: <4ep035$kdp@darkstar.UCSC.EDU>
  9. Reply-To: mkt@isun04.inf.uni-jena.de
  10. NNTP-Posting-Host: isun07.inf.uni-jena.de
  11.  
  12. >      Derived d;
  13. >      Base b;
  14. >      b = b + d;  // is d converted to b by signature match (user-defined
  15. >          // conversion) or is it an exact match due 
  16. >          // to language rules?
  17.  
  18. Answer: An object of a derived class type can be used to initialized
  19.     a reference of a base class type. (language rule)
  20.  
  21.     That means: The complete object d is passed to operator+(B&).
  22.         This can be watched by calling a virtual function inside
  23.         operator+ .
  24.  
  25. Bye.
  26.  
  27.  
  28.